# 多无人机种向日葵
# 完全没有优化，主打一个力大飞砖
import common
clear()
size = get_world_size()
drons = max_drones()
alldrons = []
if size % drons != 0 :
	size = size - (size % drons)
	set_world_size(size)
for n in range(drons):
	def plant_and_havest():
		while True:
			for i in range(get_world_size()/drons):
				for y in range(get_world_size()):
					x = n * get_world_size()/drons + i
					common.move_abs(x,y)
					if get_water() < 0.25:
						use_item(Items.Water)
					if get_ground_type() != Grounds.Soil:
						till()
					if can_harvest():
						harvest()
					plant(Entities.Sunflower)
	d =  spawn_drone(plant_and_havest)
	if d :
		alldrons.append(d)
	else:
		plant_and_havest()